export class BarnSystemInfo {
  pid?: string
  variableName: string
  variableValue: string
  updateTime?: string
  updateId?: string
  remark?: string
  isFolded?: boolean

  public static PRODUCT_MANAGER_ROLE_ID = "PRODUCT_MANAGER_ROLE_ID"
  public static PROJECT_MANAGER_ROLE_ID = "PROJECT_MANAGER_ROLE_ID"
  public static DEFAULT_PASSWORD = "DEFAULT_PASSWORD"
  public static SYSTEM_NAME = "SYSTEM_NAME"

  public static Variables: { [pid: string]: BarnSystemInfo } = {
    DEFAULT_PASSWORD: {
      pid: BarnSystemInfo.DEFAULT_PASSWORD,
      variableName: "默认密码",
      variableValue: "1",
      remark: "添加用户时的默认密码"
    },
    SYSTEM_NAME: {
      pid: BarnSystemInfo.SYSTEM_NAME,
      variableName: "系统名", variableValue: "Barn", remark: "系统名,见系统左上角"
    },
    PRODUCT_MANAGER_ROLE_ID: {
      pid: BarnSystemInfo.PRODUCT_MANAGER_ROLE_ID,
      variableName: "产品经理角色id",
      variableValue: "",
      remark: "产品经理角色的id,拥有这个角色的人员才可以查看产品使用情况"
    },
    PROJECT_MANAGER_ROLE_ID: {
      pid: BarnSystemInfo.PROJECT_MANAGER_ROLE_ID,
      variableName: "项目经理角色id",
      variableValue: "",
      remark: "项目经理角色的id,拥有这个角色的人员才可以查看项目使用情况"
    }
  }

  public static variables(): BarnSystemInfo[] {
    const result = [];
    for (let v in this.Variables) {
      const info = new BarnSystemInfo()
      info.pid = v;
      info.variableName = this.Variables[v].variableName
      info.variableValue = this.Variables[v].variableValue
      info.remark = this.Variables[v].remark
      result.push(info)
    }
    return result
  }
}
